<!DOCTYPE HTML>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<body class="gray-bg">
    
     <div class="container-div">
		<div class="row">
			<div class="col-sm-12 search-collapse">
				<form id="formId">
					<input id="byq_id" name="byqId" type="hidden">
					<input id="byq_name" name="byqName" type="hidden">
					<div class="select-list">
						<ul>
							<li>
								设备名称：<input type="text" name="name"/>
							</li>
							<li>
								<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
								<!--<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>-->
							</li>
						</ul>
					</div>
				</form>
			</div>
			<div class="col-sm-12 select-table table-striped">
				<table id="bootstrap-table" data-mobile-responsive="true"></table>
			</div>
		</div>
	</div>
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
        var editFlag = [[${@permission.hasPermi('assets:bByq:edit')}]];
        var removeFlag = [[${@permission.hasPermi('assets:bByq:remove')}]];
        var voltageGradeDatas = [[${@dict.getType('voltage_grade')}]];
        var prefix = ctx + "assets/bByq";

        $(function() {
            var options = {
                url: prefix + "/list",
                modalName: "变压器",
//		        showExport: true,
                showSearch:false,		//是否显示检索信息
                showRefresh:false,		//是否显示刷新按钮
                showToggle:false,		//是否显示详细视图和列表视图的切换按钮
                showColumns:false,		//是否显示隐藏某列下拉框
                sortable:false,		 	//是否启用排序
                columns: [{
		            radio: true
		        },
				{
					field : 'id', 
					title : 'id',
					visible: false
				},
				{
					field : 'pointId', 
					title : '点位ID',
					sortable: true,
                    visible: false
				},
				{
					field : 'name', 
					title : '设备名称',
					sortable: true
				},
				{
					field : 'runCode', 
					title : '运行编号',
					sortable: true
				},
				{
					field : 'zgb', 
					title : '专公变',
					sortable: true,
                    visible: false
				},
				{
					field : 'model', 
					title : '规格型号',
					sortable: true,
                    visible: false
				},
				{
					field : 'voltage', 
					title : '电压等级',
					sortable: true,
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(voltageGradeDatas, value);
                    }
				},
				{
					field : 'volume', 
					title : '变压器容量',
					sortable: true
				},
				{
					field : 'runTeam', 
					title : '运维班组',
					sortable: true,
                    visible: false
				},
				{
					field : 'station', 
					title : '所属站房',
					sortable: true,
                    visible: false
				},
				{
					field : 'runStatus', 
					title : '运行状态',
					sortable: true,
                    visible: false
				},
				{
					field : 'runDate', 
					title : '投运日期',
					sortable: true,
                    formatter: function (value, row, index) {
                        return value!=null?new Date(value).Format('yyyy-MM-dd'):"";
                    }
				},
				{
					field : 'factory', 
					title : '生产厂家',
					sortable: true,
                    visible: false
				},
				{
					field : 'installType', 
					title : '安装形式',
					sortable: true,
                    visible: false
				},
				{
					field : 'lineTeam', 
					title : '结线别组',
					sortable: true,
                    visible: false
				},
				{
					field : 'xNumber', 
					title : '相数',
					sortable: true,
                    visible: false
				},
				{
					field : 'unit', 
					title : '资产单位',
					sortable: true,
                    visible: false
				},
				{
					field : 'line10kvId', 
					title : '所属10kv线路ID',
					sortable: true,
                    visible: false
				},
				{
					field : 'line10kvName', 
					title : '所属10kv线路名称',
					sortable: true
				},
				{
					field : 'natureQuality', 
					title : '资产性质',
					sortable: true,
                    visible: false
				},
				{
					field : 'gisCode', 
					title : 'gis编码',
					sortable: true,
                    visible: false
				},
				{
					field : 'lgt', 
					title : '经度',
					sortable: true,
                    visible: false
				},
				{
					field : 'lat', 
					title : '纬度',
					sortable: true,
                    visible: false
				},
				{
					field : 'alt', 
					title : '高程',
					sortable: true,
                    visible: false
				},
				{
					field : 'addUser', 
					title : '创建人',
					sortable: true,
                    visible: false
				},
				{
					field : 'addDate', 
					title : '创建日期',
					sortable: true,
                    formatter: function (value, row, index) {
                        return value!=null?new Date(value).Format('yyyy-MM-dd'):"";
                    },
                    visible: false
				},
				{
					field : 'updateUser', 
					title : '最近更新人',
					sortable: true,
                    visible: false

				},
				{
					field : 'updateDate', 
					title : '最近更新日期',
					sortable: true,
                    formatter: function (value, row, index) {
                        return value!=null?new Date(value).Format('yyyy-MM-dd'):"";
                    },
                    visible: false
				},
				{
					field : 'datastate', 
					title : '数据状态',
					sortable: true,
                    visible: false
				},
		        {
		            title: '操作',
		            align: 'center',
		            formatter: function(value, row, index) {
		            	var actions = [];
		            	actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="#" onclick="$.operate.edit(\'' + row.id + '\')"><i class="fa fa-edit"></i>编辑</a> ');
                        actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="#" onclick="$.operate.remove(\'' + row.id + '\')"><i class="fa fa-remove"></i>删除</a>');
						return actions.join('');
		            },
					visible:false
		        }]
            };
            $.table.init(options);

            //单选框选择传值
            $("#bootstrap-table").on("check.bs.table", function (e, row, ele) {
                console.log("id和name=="+row.id+">>"+row.name)
                $("#byq_id").val(row.id);
                $("#byq_name").val(row.name);
            })
        });


        /**
		 * 	日期格式化
         */
        Date.prototype.Format = function (fmt) {
            var o = {
                "M+": this.getMonth() + 1, //月份
                "d+": this.getDate(), //日
                "h+": this.getHours(), //小时
                "m+": this.getMinutes(), //分
                "s+": this.getSeconds(), //秒
                "q+": Math.floor((this.getMonth() + 3) / 3), //季度
                "S": this.getMilliseconds() //毫秒
            };
            if (/(y+)/.test(fmt)) fmt = fmt.replace(RegExp.$1, (this.getFullYear() + "").substr(4 - RegExp.$1.length));
            for (var k in o)
                if (new RegExp("(" + k + ")").test(fmt)) fmt = fmt.replace(RegExp.$1, (RegExp.$1.length == 1) ? (o[k]) : (("00" + o[k]).substr(("" + o[k]).length)));
            return fmt;
        }




	</script>
</body>
</html>